//
//  PickerView.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2025/1/11.
//

import SwiftUI


// 实现 GenderItem 协议的一个简单结构体
struct PickItem : Identifiable {
    var id: String
    var name: String
}


struct PickerView: View {
    let title:String
    let options: [PickItem]
    @Binding var selectId: String
    let onDismiss: () -> Void
    
    var body: some View {
        ZStack(alignment:.top){
            PopupBottomView(title: title) {
                Picker("性别", selection: $selectId) {
                    ForEach(options) { gender in
                        Text(gender.name).tag(gender.id)
                    }
                }
                .pickerStyle(.wheel)
            }
            HStack {
                Spacer()
                Text("确定")
                    .font(.system(size: 14))
                    .foregroundStyle(.white)
                    .padding(EdgeInsets(top: 5, leading: 7, bottom: 5, trailing: 7))
                    .background(themeManager.themeColor)
                    .cornerRadius(5)
                    .onTapGesture {
                        onDismiss()
                    }
            }.padding(10)
        }
        
    }
}

#Preview {
    //    PickerView(options:genderOptions,selectId: "0") {}
}
